package com.ruicar.afs.cloud.basic.common.entity;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.ruicar.afs.cloud.common.core.entity.BaseEntity;
import com.ruicar.afs.cloud.common.modules.contract.enums.RepaymentStatusEnum;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.experimental.Accessors;
import org.springframework.format.annotation.DateTimeFormat;

import java.math.BigDecimal;
import java.util.Date;

/**
 * @author: Lee
 * @date 2020-05-29 09:31:34 
 * @description 合同还款计划表
 */
@Data
@Accessors(chain = true)
@TableName(value ="basic_repayment_plan", autoResultMap = true)
public class BasicRepaymentPlan extends BaseEntity<BasicRepaymentPlan> {

	/**
	 * 合同编号
	 */
	@ApiModelProperty("合同编号")
	private String contractNo;
	/**
	 * 期数
	 */
	@ApiModelProperty("期数")
	private Integer termNo;
	/**
	 * 应还款日期
	 */
	@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
	@DateTimeFormat(pattern = "yyyy-MM-dd")
	@ApiModelProperty("应还款日期")
	private Date dueDate;
	/**
	 * 实际收款日期
	 */
	@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
	@DateTimeFormat(pattern = "yyyy-MM-dd")
	@ApiModelProperty("实际收款日期")
	private Date actualPaymentDate;
	/**
	 * 剩余本金
	 */
	@ApiModelProperty("剩余本金")
	private BigDecimal remainPrinciple;
	/**
	 * 应收租金
	 */
	@ApiModelProperty("应收租金")
	private BigDecimal receivableRent;
	/**
	 * 应收本金
	 */
	@ApiModelProperty("应收本金")
	private BigDecimal receivablePrinciple;
	/**
	 * 应收利息
	 */
	@ApiModelProperty("应收利息")
	private BigDecimal receivableInterest;
	/**
	 * 实收租金
	 */
	@ApiModelProperty("实收租金")
	private BigDecimal actualRent;
	/**
	 * 实收本金
	 */
	@ApiModelProperty("实收本金")
	private BigDecimal actualPrinciple;
	/**
	 * 实收利息
	 */
	@ApiModelProperty("实收利息")
	private BigDecimal actualInterest;
	/**
	 * 收入
	 */
	@ApiModelProperty("收入")
	private BigDecimal income;
	/**
	 * 税金
	 */
	@ApiModelProperty("税金")
	private BigDecimal tax;
	/**
	 * 税率
	 */
	@ApiModelProperty("税率")
	private BigDecimal rate;
	/**
	 * 状态 枚举值：未还、已还、逾期、合同取消、提前结清
	 */
	@ApiModelProperty("状态 枚举值：未还、已还、逾期、合同取消、提前结清")
	private RepaymentStatusEnum status;
	/** 绝对逾期天数 **/
	@ApiModelProperty("绝对逾期天数")
	private String currentAbsoluteOverdue;




	/**
	 * 总本金 by ZC.GUO
	 **/
	@TableField(exist = false)
	private BigDecimal totalPrinciple;
	/**
	 * 总利息 by ZC.GUO
	 **/
	@TableField(exist = false)
	private BigDecimal totalInterest;
	/**
	 * 总租金 by ZC.GUO
	 **/
	@TableField(exist = false)
	private BigDecimal totalRent;
	@TableField(exist = false)
	/**  已还期数 by ZC.GUO  **/
	private Integer paidTerms;
	@TableField(exist = false)
	/**  合同最后一次还款日 by ZC.GUO  **/
	private Date lastPayDate;
	@TableField(exist = false)
	/**  合同首次应还款日 by ZC.GUO  **/
	private Date firstPayDate;
	@TableField(exist = false)
	/**  合同未偿租金 by ZC.GUO  **/
	private BigDecimal unpaidRent;
	/** 未偿本金 by ZC.GUO  **/
	@TableField(exist = false)
	private BigDecimal totalUnpaidPrinciple;
	/** 未偿利息 by ZC.GUO  **/
	@TableField(exist = false)
	private BigDecimal totalUnpaidInterest;
	/**
	 * 应收利息总额
	 **/
	@TableField(exist = false)
	private BigDecimal totalReceivableInterest;

	/**
	 * 已偿本金 by ZC.GUO
	 **/
	@TableField(exist = false)
	private BigDecimal paidPrinciple;
	/**
	 * 已偿利息 by ZC.GUO
	 **/
	@TableField(exist = false)
	private BigDecimal paidInterest;
	/**
	 * 已偿租金 by ZC.GUO
	 **/
	@TableField(exist = false)
	private BigDecimal totalPaidRent;

	/**
	 * 上一次还款日 by ZC.GUO
	 **/
	@TableField(exist = false)
	private Date prePayDate;

	/**
	 * 费用金额
	 **/
	@TableField(exist = false)
	@ApiModelProperty("费用金额")
	private BigDecimal costFree = new BigDecimal(0);

}
